﻿<Application x:Class="Application"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="MainWindow.xaml">
    <Application.Resources>

        <Style TargetType="{x:Type ListViewItem}">
            <Setter Property="TextBlock.FontFamily" Value="Segoe UI" />
            <Setter Property="TextBlock.FontSize" Value="12" />
            <Setter Property="Height" Value="48" />
        </Style>

        <LinearGradientBrush x:Key="AppGradient" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="White" Offset="1"/>
            <GradientStop Color="#FF86C0F0" Offset="0"/>
        </LinearGradientBrush>

        <DataTemplate x:Key="ImgCell">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="64" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>

                </Grid.RowDefinitions>

                <Image Source="{Binding DeviceIcon}"
                       RenderOptions.BitmapScalingMode="HighQuality"
                       SnapsToDevicePixels="True"
                       MinWidth="32"
                       Stretch="None"
                       Grid.Column="0" 
                       Grid.Row="0"
                       Grid.RowSpan="2"/>

                <TextBlock Text="{Binding UIDescription}"
                           VerticalAlignment="Center"   
                           Grid.Column="1" 
                           Grid.Row="0"/>

                <TextBlock Text="{Binding ClassName}"
                           VerticalAlignment="Center"   
                           FontSize="8"
                           Grid.Column="1"
                           Grid.Row="1"/>

            </Grid>

        </DataTemplate>

        <DataTemplate x:Key="NetCell">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="64" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>

                </Grid.RowDefinitions>

                <Image Source="{Binding DeviceIcon}"
                       MinWidth="32"
                       Stretch="None"
                       Grid.Column="0" 
                       Grid.Row="0"
                       Grid.RowSpan="2"/>

                <TextBlock Text="{Binding Description}"
                           VerticalAlignment="Center"   
                           Grid.Column="1" 
                           Grid.Row="0"/>

                <TextBlock Text="{Binding DeviceInfo.Manufacturer}"
                           VerticalAlignment="Center"   
                           FontSize="8"
                           Grid.Column="1"
                           Grid.Row="1"/>

            </Grid>

        </DataTemplate>

        <DataTemplate x:Key="LibraryCell">
            <Grid Margin="2,4,2,4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="64" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Image Source="{Binding DefaultImage}"
                       RenderOptions.BitmapScalingMode="HighQuality"
                       SnapsToDevicePixels="True"
                       Stretch="Uniform"
                       Width="48"
                       Height="48"
                       Grid.Column="0" 
                       Grid.Row="0"
                       Grid.RowSpan="2"/>

                <TextBlock Text="{Binding Description}"
                           VerticalAlignment="Center"   
                           FontSize="12"
                           Grid.Column="1" 
                           Grid.Row="0"/>

                <TextBlock Text="{Binding PreferredHandler.UIName}"
                           VerticalAlignment="Center"   
                           FontSize="10"
                           Grid.Column="1" 
                           Grid.Row="1"/>

                <TextBlock Text="{Binding Extension}"
                           VerticalAlignment="Center"   
                           FontSize="8"
                           Grid.Column="1" 
                           Grid.Row="2"/>

            </Grid>

        </DataTemplate>

        <DataTemplate x:Key="LibraryCellSmall">
            <Grid Margin="2,4,2,4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="32" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Image Source="{Binding DefaultImage}"
                       RenderOptions.BitmapScalingMode="HighQuality"
                       SnapsToDevicePixels="True"
                       Stretch="Uniform"
                       Width="24"
                       Height="24"
                       Grid.Column="0" 
                       Grid.Row="0"
                       Grid.RowSpan="2"/>

                <TextBlock Text="{Binding Description}"
                           VerticalAlignment="Center"   
                           FontSize="10"
                           Grid.Column="1" 
                           Grid.Row="0"/>

            </Grid>

        </DataTemplate>

        <DataTemplate x:Key="ProgramCell">
            <Grid Margin="2,4,2,4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="64" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Image Source="{Binding Image}"
                       RenderOptions.BitmapScalingMode="HighQuality"
                       VerticalAlignment="Top"
                       SnapsToDevicePixels="True"
                       Stretch="Uniform"
                       Width="48"
                       Height="48"
                       Grid.Column="0" 
                       Grid.Row="0"
                       Grid.RowSpan="2"/>

                <TextBlock Text="{Binding UIName}"
                           VerticalAlignment="Center"   
                           FontSize="12"
                           Grid.Column="1" 
                           Grid.Row="0"/>

                <Grid Grid.Row="1"
                      Grid.Column="1">

                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <TextBlock Text="{Binding Preferred}"
                           VerticalAlignment="Center"   
                           FontSize="10"
                           Grid.Column="0" 
                           Grid.Row="0"/>

                    <ItemsControl
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        ItemsSource="{Binding AssocList}"
                        Grid.Row="1"
                        Grid.Column="0"
                        ItemTemplate="{DynamicResource LibraryCellSmall}"
                        Background="{x:Null}">

                    </ItemsControl>

                </Grid>
            </Grid>

        </DataTemplate>
    </Application.Resources>
</Application>
